using System;
using Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response;
using Sinacor.Servico.Bovespa.Cliente.BusinessEntity;

namespace Sinacor.Servico.Bovespa.Cliente.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenNumeroTelefoneResponseAndNumeroTelefone
    {
        public static DataContract.Response.TelefoneResponse TranslateNumeroTelefoneToNumeroTelefoneResponse(BusinessEntity.Telefone from)
        {

            if (from == null) return null;

            DataContract.Response.TelefoneResponse to = new DataContract.Response.TelefoneResponse();
            to.DDD = from.DDD;
            to.Numero = from.Numero;
            to.Ramal = from.Ramal;
            to.TipoTelefone = (DataContract.Enum.TipoTelefone) from.TipoTelefone;
            to.Contato = from.Contato;
            return to;
        }

        public static BusinessEntity.Telefone TranslateNumeroTelefoneResponseToNumeroTelefone(DataContract.Response.TelefoneResponse from)
        {

            if (from == null) return null;

            BusinessEntity.Telefone to = new BusinessEntity.Telefone();
            to.DDD = from.DDD;
            to.Numero = from.Numero;
            to.Ramal = from.Ramal;
            to.Contato = from.Contato;
            to.TipoTelefone = (BusinessEntity.Enum.TipoTelefone) from.TipoTelefone;
            return to;
        }
    }
}

